<?php


namespace App\W7OpenTracing\Providers;


use App\W7OpenTracing\Middleware\OpenTracingMiddleware;
use App\W7OpenTracing\TracerFactory;
use Illuminate\Support\ServiceProvider;
use OpenTracing\Tracer;

class OpenTracingServiceProvider extends ServiceProvider
{
    public function register()
    {
        $path = __DIR__ . '/../config/opentracing.php';
        $this->mergeConfigFrom($path, 'opentracing');

        $this->app->singleton(Tracer::class, function () {
            return (new TracerFactory())->makeTracer();
        });
        $this->app->alias(OpenTracingMiddleware::class, 'opentracing');
    }
}
